﻿using System;
using Windows.UI.Xaml.Data;

namespace Looptribe.Moodlin8.UIHelper
{
    public class FileTypeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string culture)
        {
            var fileType = (string) value;
            switch (fileType.ToLower())
            {
                case ".doc":
                case ".docx":
                    return "ms-appx:///Assets/Icon_DOC.png";
                case ".pdf":
                    return "ms-appx:///Assets/Icon_PDF.png";
                case ".ppt":
                case ".pptx":
                    return "ms-appx:///Assets/Icon_PPT.png";
                case ".xls":
                case ".xlsx":
                    return "ms-appx:///Assets/Icon_XLS.png";
                case ".jpg":
                case ".png":
                case ".bmp":
                case ".gif":
                    return "ms-appx:///Assets/Icon_Photo.png";
                case ".avi":
                case ".mpg":
                    return "ms-appx:///Assets/Icon_Video.png";
                default:
                    return "ms-appx:///Assets/Icon_FILE.png";

            }
        }

        public object ConvertBack(object value, Type targetType, object parameter,
                                  string culture)
        {
            throw new NotSupportedException();
        }
    }
}
